<?php
/**
 * 默认接口服务类
 * php.ini 需要开启 display_errors = On 才会有错误返回
 * @author: dogstar <chanzonghuang@gmail.com> 2014-10-04
 */

class Api_Default extends PhalApi_Api {

	public function getRules() {
		return array(
			'index' => array(
				'username' => array('name' => 'username', 'default' => 'PHPer'),
			),
		);
	}

	/**
	 * 默认接口服务
	 * @return string title 标题
	 * @return string content 内容
	 * @return string version 版本，格式：X.X.X
	 * @return int time 当前时间戳
	 */
	public function index() {
		return array(
			'title' => 'Hello World!',
			'content' => T('Hi {name}, welcome to use PhalApi!', array('name' => $this->username)),
			'version' => PHALAPI_VERSION,
			'time' => $_SERVER['REQUEST_TIME'],
		);
	}
}
